<!--待开发发票列表-->
<script type="application/xhtml+xml" id="combine-receive-paper">
    <table class="table table-bordered list-bill" style="width: auto;">
        <thead>
        <tr>
            <th style="border-left: 1px solid #dddddd;">收货单号</th>
            <th>产品</th>
            <th>数量</th>
            <th>已收票数量</th>
            <th>本次收票数量</th>
            <th>单价</th>
            <th>税率</th>
            <th>价税合计金额</th>
            <th>税额</th>
            <th>不含税金额</th>
        </tr>
        </thead>
        <tbody>
        <$

        var totalNumber = 0,totalReceive = 0,totalPapered = 0,totalThisTime = 0,total1 = 0,totalTax = 0;
        list.map(function(item){
        totalNumber =floatTool.add(totalNumber,item.numberReceive||0);
        totalReceive =floatTool.add(totalReceive,item.numberReceive);
        totalPapered =floatTool.add(totalPapered,item.numberPapered||0);
        totalThisTime =floatTool.add(totalThisTime,floatTool.subtract(item.numberReceive||0,item.numberPapered||0));
        total1 =floatTool.add(total1,floatTool.multiply(floatTool.subtract(item.numberReceive,(item.numberPapered||0)),item.price));
        totalTax =floatTool.add(totalTax,taxTotal(item.taxRatio,floatTool.multiply(floatTool.subtract(item.numberReceive,(item.numberPapered||0)),item.price)));
        $>
        <tr>
            <td style="border-left:1px solid #dddddd;"><$=item.no $></td>
            <td><$=item.goodsName $></td>
            <td><$=item.numberReceive $></td>
            <td><$=(item.numberPapered||0) $></td>
            <td style="padding:1px;">
                <input type="text" class="form-control" name="numbers" value="<$=floatTool.subtract(item.numberReceive,(item.numberPapered||0)) $>"
                       max="<$=floatTool.subtract(item.numberReceive,item.numberPapered) $>"
                       data-json="<$=JSON.stringify(item)$>"
                />
                <input type="hidden" name="orderId" value="<$=item.id $>" />
            </td>
            <td><$=item.price $></td>
            <td><$=(item.taxRatio*100)+'%' $></td>
            <td style="padding:1px;">
                <input
                readonly="readonly"
                type="text" class="form-control"
                name="total_"
                value=" <$=floatTool.multiply(floatTool.subtract(item.numberReceive,(item.numberPapered||0)),item.price) $>" />
            </td>
            <td style="padding:1px;">
                <input type="text" name="taxTotal"
                        readonly="readonly"
                       class="form-control"
                        value="<$=taxTotal(item.taxRatio,floatTool.multiply(floatTool.subtract(item.numberReceive,(item.numberPapered||0)),item.price))$>" />
            </td>
            <td style="padding:1px;">
                <input
                    value="<$=floatTool.subtract(floatTool.multiply(floatTool.subtract(item.numberReceive,(item.numberPapered||0)),item.price),taxTotal(item.taxRatio,floatTool.multiply(floatTool.subtract(item.number,(item.numberPapered||0)),item.price)))$>"
                    type="text" class="form-control" name="totalSub" readonly="readonly" />
            </td>
        </tr>
 <$ })$>
        <tr>
            <td style="border-left:1px solid #dddddd;">合计</td>
            <td></td>
            <td><$=totalNumber $></td>
            <td><$=totalPapered $></td>
            <td style="padding:1px;">
                <$=totalThisTime $>
            </td>
            <td></td>
            <td></td>
            <td style="padding:1px;">
                <$=total1 $>
            </td>
            <td style="padding:1px;">
                <$=totalTax $>
            </td>
            <td style="padding:1px;">
                <$=floatTool.subtract(total1,totalTax)$>
            </td>
        </tr>
 </tbody>
</table>
</script>
<script type="application/xhtml+xml" id="combine-receive-bill">
    <table class="table table-bordered">
        <thead>
            <tr class="form-group">
                <th></th>
                <th>收货单号</th>
                <th>产品名称</th>
                <th>客户名称</th>
                <th>品质规格</th>
                <th>数量</th>
                <th>单价</th>
                <th>实收数量</th>
                <th>已开票数量</th>
            </tr>
        </thead>
        <tbody>
        <$
        var totalNumber = 0,totalReceive = 0,totalPapered = 0;
        if(list!='undefined'){
        list.map(function(item){
        totalNumber =floatTool.add(totalNumber,item.numberReceive);
        totalReceive =floatTool.add(totalReceive,item.numberReceive);
        totalPapered =floatTool.add(totalPapered,item.numberPapered||0);
        $>
        <tr class="form-group">
            <td><input type="checkbox" <$ if(selected[item.id]){$>checked<$}$> data-json="<$=JSON.stringify(item)$>"/></td>
            <td><$=item.no $></td>
            <td><$=item.goodsName $></td>
            <td><$=item.clienteleName $></td>
            <td><$=item.quality $></td>
            <td><$=item.number $></td>
            <td><$=item.price $></td>
            <td><$=item.numberReceive $></td>
            <td><$=(item.numberPapered||0) $></td>
        </tr>
        <$})}$>
        <tr class="form-group">
            <td>合计</td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td><$=totalNumber $></td>
            <td></td>
            <td><$=totalReceive $></td>
            <td><$=totalPapered $></td>
        </tr>
        </tbody>
    </table>
</script>
